package com.njbdqn.ALi.zjg.dao;

import org.njbdqn.ali.database.SqlTemplate;

import com.njbdqn.ALi.zjg.entity.RecommendNeedRecord;
import com.njbdqn.ALi.zjg.vo.RecommendNeedRecordVO;


public class RecommendNeedRecordDAO {
	private SqlTemplate template;
	
	public RecommendNeedRecordDAO(){
		template = new SqlTemplate();
	}
	public int save(RecommendNeedRecord rnr){
		String sql="insert into recommendneedrecord(bind,recommendbookname,"
				+ "recommendbookvotenumber,recommendbooktime) values(?,?,?,?)";
		return template.update(sql, new Object[]{rnr.getBind(),rnr.getRecommendbookname(),
				rnr.getRecommendbookvotenumber(),rnr.getRecommendbooktime()});
	}
	public RecommendNeedRecordVO findAll(String bind){
		String sql="select recommendbookname,recommendbookvotenumber,recommendbooktime "
				+ "from recommendneedrecord where bind=?";
		return (RecommendNeedRecordVO) template.resultToArray(sql, new Object[]{bind}, RecommendNeedRecordVO.class);
	}

}
